
%Dirichlet
%
clear all
close all


 disp('Random CDF''s for Beta Base')
  lw = 3; 
  set(0, 'DefaultAxesFontSize', 16);
  fs = 15;
  msize = 10;
  



n = 30;  %generate random cdf's at 30 equispaced points
a = 2; %a, b are parameters of the BASE distribution, G_0 = Beta(2,2)
b = 2;
alpha = 20; %The precision parameter alpha = 20 describes
% scattering about the BASE distribution. Higher alpha, less variability.
%-------------------
x = linspace(1/n,1,n); %the equispaced points at which random CDF's are
%  evaluated.
y = cdf_beta(x, a, b);   % find CDF's of BASE
par = [y(1) diff(y)];    % and form a Dirichlet parameter
%-----------------------
for i = 1:15  % Generate 15 random CDF's.
   yy = rand_dirichlet(alpha * par,1);
   plot( x, cumsum(yy),'-','linewidth',1) %cummulative sum
   % of Dirichlet vector is a random CDF
hold on
end
yyy = 6 .* (x.^2/2 - x.^3/3);  %Plot BASE CDF as reference
plot( x, yyy, ':', 'linewidth',3)
axis tight

print -deps 'C:\NPBook\NPBayes\Dirpro.eps'


